package com.Telien.app.ui.main;

import javax.swing.JLabel;
import javax.swing.JPanel;

import com.Telien.app.user.object.User;

public class UserDetailsPanel extends JPanel{
	JLabel lblUserName = new JLabel("User Name: ");
	JLabel lblFirstName = new JLabel("First Name: ");
	JLabel lblLastName = new JLabel("Last Name: ");
	JLabel lblEmail = new JLabel("Email Address: ");
	JLabel lblPhone = new JLabel("Phone Number: ");
	JLabel lblRole = new JLabel("Role: ");
	
	JLabel lblUserNameTxt = new JLabel();
	JLabel lblFirstNameTxt = new JLabel();
	JLabel lblLastNameTxt = new JLabel();
	JLabel lblEmailTxt = new JLabel();
	JLabel lblPhoneTxt = new JLabel();
	JLabel lblRoleTxt = new JLabel();
	
	public UserDetailsPanel(User user) {
		lblUserNameTxt.setText(user.getUserName());
		lblFirstNameTxt.setText(user.getFirstName());
		lblLastNameTxt.setText(user.getLastName());
		lblEmailTxt.setText(user.getEmailAddress());
		lblPhoneTxt.setText(user.getPhoneNumber());
		if (user.getRole() == 1)
			lblRoleTxt.setText("Admin");
		else
			lblRoleTxt.setText("User");
		this.initialize();
	}

	private void initialize() {
		setSize(600, 500);
		setLayout(null);
		
		lblUserName.setBounds(10, 25, 95, 25);
		add(lblUserName);
				
		lblFirstName.setBounds(10, 50, 95, 25);
		add(lblFirstName);
				
		lblLastName.setBounds(10, 75, 95, 25);
		add(lblLastName);
		
		lblEmail.setBounds(10, 100, 95, 25);
		add(lblEmail);
		
		lblPhone.setBounds(10, 125, 95, 25);
		add(lblPhone);
		
		lblRole.setBounds(10, 150, 95, 25);
		add(lblRole);
		
		
		
		lblUserNameTxt.setBounds(120, 25, 150, 25);
		add(lblUserNameTxt);
		
		lblFirstNameTxt.setBounds(120, 50, 150, 25);
		add(lblFirstNameTxt);
		
		lblLastNameTxt.setBounds(120, 75, 150, 25);
		add(lblLastNameTxt);
		
		lblEmailTxt.setBounds(120, 100, 150, 25);
		add(lblEmailTxt);
		
		lblPhoneTxt.setBounds(120, 125, 150, 25);
		add(lblPhoneTxt);
		
		lblRoleTxt.setBounds(120, 150, 150, 25);
		add(lblRoleTxt);
		
		setVisible(true);
	}
}
